<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Replace regular expression with multibyte support</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-ereg-replace-callback.html">mb_ereg_replace_callback</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-ereg-search-getpos.html">mb_ereg_search_getpos</a></div>
 <div class="up"><a href="ref.mbstring.html">多字节字符串 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.mb-ereg-replace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_ereg_replace</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">mb_ereg_replace</span> &mdash; <span class="dc-title">Replace regular expression with multibyte support</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-ereg-replace-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>mb_ereg_replace</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pattern</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$replacement</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$option</code><span class="initializer"> = &quot;msr&quot;</span></span>
  ] )</div>

  <p class="simpara">
   Scans <em><code class="parameter">string</code></em> for matches to
   <em><code class="parameter">pattern</code></em>, then replaces the matched text
   with <em><code class="parameter">replacement</code></em>  
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-ereg-replace-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">pattern</code></em></dt>

     <dd>

      <p class="para">
       The regular expression pattern.
      </p>
      <p class="para">
       Multibyte characters may be used in <em><code class="parameter">pattern</code></em>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">replacement</code></em></dt>

     <dd>

      <p class="para">
       The replacement text.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">string</code></em></dt>

     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being checked.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">option</code></em></dt>

     <dd>

      <span class="simpara">
       Matching condition can be set by <em><code class="parameter">option</code></em>
       parameter. If <em>i</em> is specified for this
       parameter, the case will be ignored. If <em>x</em> is
       specified, white space will be ignored. If <em>m</em>
       is specified, match will be executed in multiline mode and line
       break will be included in &#039;.&#039;. If <em>p</em> is
       specified, match will be executed in POSIX mode, line break 
       will be considered as normal character. If <em>e</em>
       is specified, <em><code class="parameter">replacement</code></em> string will be
       evaluated as PHP expression.
      </span>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-ereg-replace-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The resultant <span class="type"><a href="language.types.string.html" class="type string">string</a></span> on success, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mb-ereg-replace-notes">
  <h3 class="title">注释</h3>
  
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"><span class="function"><a href="function.mb-regex-encoding.html" class="function">mb_regex_encoding()</a></span>
指定的内部编码或字符编码将会当作此函数用的字符编码。</p></p></blockquote>
  <div class="warning"><strong class="warning">Warning</strong><p class="para">处理非信任的输入时从不使用
<em>e</em> 修饰符，就不会转码（即调用 <span class="function"><a href="function.preg-replace.html" class="function">preg_replace()</a></span>）。不注意这些会很可能会导致应用程序引发远程代码执行的漏洞。</p></div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-ereg-replace-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.mb-regex-encoding.html" class="function" rel="rdfs-seeAlso">mb_regex_encoding()</a> - Set/Get character encoding for multibyte regex</span></li>
    <li class="member"><span class="function"><a href="function.mb-eregi-replace.html" class="function" rel="rdfs-seeAlso">mb_eregi_replace()</a> - Replace regular expression with multibyte support ignoring case</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-ereg-replace-callback.html">mb_ereg_replace_callback</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-ereg-search-getpos.html">mb_ereg_search_getpos</a></div>
 <div class="up"><a href="ref.mbstring.html">多字节字符串 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
